﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VISS.API.Users;
using NCT.Framework;

/// <summary>
/// Summary description for AvatarUtils
/// </summary>
namespace VISS.Web.Frontend {

    public class AvatarUtils {
        public AvatarUtils() {
            //
            // TODO: Add constructor logic here
            //
        }

        public static string GetAvatarPath(string avatarFileName, int AvatarImageStoreID, EUserGender gender, EUserAvatarStatus status) {
            if (!string.IsNullOrEmpty(avatarFileName) && status == EUserAvatarStatus.Available)
                return AppSettings.ImageStoreUploadServer + avatarFileName + "?" + NumberUtils.GetRandomNum(0, 2010);
            else {
                if (gender == EUserGender.Male) {
                    return AppSettings.AvatarMLargeBlank;
                }
                else {
                    return AppSettings.AvatarFLargeBlank;
                }
            }
        }

        public static string GetAvatarThumbPath(string avatarFileName, int AvatarImageStoreID, EUserGender gender, EUserAvatarStatus status) {
            if (!string.IsNullOrEmpty(avatarFileName) && status == EUserAvatarStatus.Available) {
                int indexOfDot = avatarFileName.LastIndexOf(".");
                string avatarThumbFileName = avatarFileName.Substring(0, indexOfDot) + "-thumb" + avatarFileName.Substring(indexOfDot);

                return AppSettings.ImageStoreUploadServer + avatarThumbFileName + "?" + NumberUtils.GetRandomNum(0, 2010);
            }
            else {
                if (gender == EUserGender.Male) {
                    return AppSettings.AvatarMSmallBlank;
                }
                else {
                    return AppSettings.AvatarFSmallBlank;
                }
            }
        }
    }
}